package com.fujimana.rockincat.restree.text.xml;

import java.io.ByteArrayInputStream;
import java.util.Locale;

import javax.xml.bind.JAXB;

import com.fujimana.rockincat.restree.annotation.mime.MimeType;
import com.fujimana.rockincat.restree.converter.Binder;

@MimeType(type="text/xml")
public class XMLBinder implements Binder {

	@SuppressWarnings("unchecked")
	@Override
	public <T> T bind(byte[] data, Class<T> type, Locale locale, String charset) {
		 Object ret = JAXB.unmarshal(new ByteArrayInputStream(data), type);
         return (T) ret;
	}

}
